import cn.zgr.ssm.entity.Student;
import cn.zgr.ssm.entity.StudentVO;
import cn.zgr.ssm.mapper.StudentMapper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sound.midi.Soundbank;
import java.util.List;
import java.util.SortedMap;

public class StudentMapperCase {
    private StudentMapper studentMapper;
    private AbstractApplicationContext ac;

    @Test
    public void getList(){
        List<Student> list = studentMapper.getList();
        for (Student student : list) {
            System.out.println(student);
        }
    }

    @Test
    public void getStudentVOList(){
        List<StudentVO> list = studentMapper.getStudentVOList();
        for(StudentVO s : list){
            System.out.println(s);
        }
    }

    @Before
    public void doBefore(){
        ac = new ClassPathXmlApplicationContext("applicationContent.xml");
        studentMapper = ac.getBean("studentMapper", StudentMapper.class);
    }

    @After
    public void doAfter(){
        ac.close();
    }

}
